Skip to content

Switch from OpenGL to Metal#39

Merged
desertkun merged 4 commits into
masterfrom
metal
May 21, 2026
Merged

Switch from OpenGL to Metal#39
desertkun merged 4 commits into
masterfrom
metal

Conversation

@morozov
Copy link
Copy Markdown
Member

@morozov morozov commented May 19, 2026

Apple deprecated OpenGL on macOS in 2018 (10.14 Mojave). On Apple Silicon — the primary target — OpenGL calls go through a software translation layer that Metal replaces with native execution.

What this PR does

DisplayOpenGLView becomes an MTKView subclass and Texture is backed by an MTLTexture; the OpenGL framework link is removed in the same commit. The view's public API is preserved, so the controllers that reach through it are untouched and the diff is contained to the view and its texture helper. The macOS deployment target is raised from 10.13 to 14.0 so the renderer can use MTKView's built-in display loop. Three commits stage the work so the renderer rewrite can be reviewed in isolation: framework + deployment-target bump first, shader source second, renderer swap third.

User-visible changes

None functional. The emulator runs the same machines, same scalers, same fullscreen behavior. On Retina displays pixels now sample at integer multiples of physical resolution rather than being soft-upscaled by AppKit, which makes the image marginally crisper — unlikely to be noticed unless someone is looking for it.

Tradeoffs

The class name DisplayOpenGLView is preserved through this migration to keep the renderer-swap diff minimal; the rename to DisplayView is tracked as mechanical follow-up. Bumping the macOS deployment target to 14.0 drops compatibility with 10.13–13.

morozov and others added 4 commits May 16, 2026 14:45
Groundwork for the renderer swap from OpenGL to Metal. Links the
two frameworks and bumps the macOS deployment target to 14.0 so
the renderer commit can target the modern AppKit display-link
API. OpenGL.framework stays linked here; the renderer-swap commit
removes it. Runtime behavior is unchanged.
Stages the vertex/fragment shaders the renderer commit will bind,
so that commit can carry only the renderer rewrite itself. The
shaders compile into the default Metal library at this commit
but are not referenced at runtime yet.
Completes the migration started by the previous two commits.
DisplayOpenGLView is now an MTKView subclass, Texture is backed
by an MTLTexture, and the OpenGL framework link is removed. The
view's public API is preserved, so the controllers that reach
through it are untouched and the change is contained to the view
and its texture helper.
@desertkun desertkun merged commit d4da138 into master May 21, 2026
2 checks passed
@desertkun desertkun deleted the metal branch May 21, 2026 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants